package hotel.switchs.oversea.biz.utils;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author lmf
 * @Date 2020/5/14 18:01
 * 自定义异常类
 **/
/*@ControllerAdvice*/
public class SwitchExceptionHandler {

    @ResponseBody
    @ExceptionHandler(RuntimeException.class)
    public Map<String,Object> handleException(Exception e){
        Map<String,Object> map=new HashMap<>();
        map.put("code","302");
        map.put("messsage",e.getMessage());
        return map;
    }
}
